// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import com.nokia.symbian 1.1
import "cores.js" as Cores

Rectangle {
    id: root;
    width: 100; height: colMain.height
    color: Cores.COR_FUNDO
    state: "FECHADO"
    radius: 10

    states: [
        State {
            name: "ABERTO"

            PropertyChanges { target: root; y: posicaoInicial - root.height }
            PropertyChanges { target: root; opacity: 1 }
        },
        State {
            name: "FECHADO"

            PropertyChanges { target: root; y: posicaoInicial }
        }
    ]

    transitions: [
        Transition {
            from: "FECHADO"; to: "ABERTO"
            ParallelAnimation {
                SpringAnimation { target: root; property:"y"; spring:3.2; damping: 0.33; mass: 2.3 }
                SmoothedAnimation { target: root; property:"opacity"; duration: 100 }
            }
        },
        Transition {
            from: "ABERTO"; to: "FECHADO"

            SequentialAnimation {
                NumberAnimation { target: root; property:"y"; duration: 600; }
                PropertyAction { target: root; property:"opacity"; value: 0 }
            }
        }
    ]

    property int posicaoInicial : 0
    property bool aberto : false

    onPosicaoInicialChanged: {
        y = posicaoInicial;
    }

    property alias checkNovasSelecionado : chkNova.checked
    property alias checkContatadasSelecionado: chkContatadas.checked
    property alias checkMarcadasSelecionado: chkMarcadas.checked
    signal btnAvancado()

    function abrir()
    {
        aberto = true;
        state = "ABERTO";
    }

    function fechar()
    {
        aberto = false;
        state = "FECHADO";
    }

    Column {
        id: colMain
        spacing: 5
        anchors.centerIn: parent

        CheckBox {
            id: chkNova
            text: "Novas"
        }

        CheckBox {
            id: chkContatadas
            text: "Contatadas"
        }

        CheckBox {
            id: chkMarcadas
            text: "Marcadas"
        }

        Button {
            text: "Avançado"
            onClicked: btnAvancado();
        }
    }
}
